﻿using Architecture.API.Application.TraceabilityCommand.AdditiveCommand;
using MediatR;
using Traceability.Domain.Service.AdditiveServices;
using Traceability.Domain.SupplierDomain;

namespace Architecture.API.Application.TraceabilityCommandHandler.AdditiveCommandHandler
{
    public class ReverseAdditiveCommandHandler : IRequestHandler<ReverseAdditiveCommand, Additive>
    {
        /// <summary>
        /// 添加剂服务
        /// </summary>
        protected readonly IAdditiveService additiveServices;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="additiveServices">添加剂</param>
        public ReverseAdditiveCommandHandler(IAdditiveService additiveServices)
        {
            this.additiveServices = additiveServices;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task<Additive> Handle(ReverseAdditiveCommand request, CancellationToken cancellationToken)
        {
            return await additiveServices.GetAdditiveModel(request.AdditiveId);
        }
    }
}
